<template>
  <header class="header">
    <!-- 左侧：网站标题 -->
    <router-link to="/interview" class="interview-logo"> 面试导航 </router-link>
    <!-- 中间：导航栏 -->
    <nav class="header-center">
      <router-link class="nav-item nav-item-js" to="/javascript"
        >JavaScript</router-link
      >
      <router-link class="nav-item nav-item-ts" to="/typescript"
        >TypeScript</router-link
      >
      <router-link class="nav-item nav-item-react" to="/react"
        >React</router-link
      >
      <router-link class="nav-item nav-item-node" to="/node"
        >Node.js</router-link
      >
 
      <router-link class="nav-item nav-item-fe" to="/frontend-engineering"
        >前端工程化</router-link
      >
      <router-link class="nav-item nav-item-perf" to="/performance"
        >前端性能优化</router-link
      >
           <router-link class="nav-item nav-item-net" to="/Game"
        >娱乐</router-link
      >
      <router-link class="nav-item nav-item-interview" to="/career"
        >音乐</router-link
      >
    </nav>
    <!-- 右侧：搜索框 -->
    <div class="header-right">
      <input
        type="text"
        placeholder="搜索..."
        v-model="search"
        @keyup.enter="onSearch"
      />
    </div>
  </header>
</template>

<script lang="ts" setup>
import { ref } from "vue";

const search = ref("");

function onSearch() {
  // 根据业务需求实现搜索逻辑，比如路由跳转或列表过滤
  alert(`搜索：${search.value}`);
}
</script>

<style scoped lang="scss">
.interview-logo {
  font-size: 1.8em;
  font-weight: bold;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(90deg, #ff00cc, #3333ff, #00ffff);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  transition: all 0.3s ease;

  &:hover {
    transform: scale(1.1) rotate(-2deg);
    text-shadow: 0 0 8px #ff00cc, 0 0 12px #00ffff;
  }
}

.nav-item-interview {
  background: linear-gradient(45deg, #fc466b, #3f5efb);
  color: #fff;
  transition: all 0.4s ease;

  &:hover {
    background: linear-gradient(90deg, #ff6a00, #ee0979);
    transform: scale(1.1) rotate(-1deg);
    box-shadow: 0 4px 15px rgba(255, 106, 0, 0.4);
  }
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  background: linear-gradient(45deg, #0a174e, #3a1794);
  color: #fff;
  flex-wrap: wrap;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.header-left h1 {
  font-size: 1.8em;
  margin: 0;
  letter-spacing: 1px;
}

.header-center {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin: 10px 0;
}

.nav-item {
  padding: 10px 15px;
  text-decoration: none;
  border-radius: 6px;
  transition: transform 0.3s ease, background 0.3s ease;
  font-weight: bold;
}

/* 鼠标悬停：放大并加亮 */
.nav-item:hover {
  transform: scale(1.1);
  filter: brightness(1.2);
}

/* 不同颜色的导航项 */
.nav-item-js {
  background: #f0db4f;
  color: #333;
}
.nav-item-ts {
  background: #007acc;
  color: #fff;
}
.nav-item-react {
  background: #61dafb;
  color: #000;
}
.nav-item-node {
  background: #68a063;
  color: #fff;
}
.nav-item-net {
  background: #ff7f50;
  color: #fff;
}
.nav-item-fe {
  background: #6a5acd;
  color: #fff;
}
.nav-item-perf {
  background: #20b2aa;
  color: #fff;
}
.nav-item-interview {
  background: #ff69b4;
  color: #fff;
}

/* 搜索框样式 */
.header-right input {
  padding: 10px;
  border-radius: 4px;
  border: none;
  outline: none;
  font-size: 1em;
}
</style>
